#include "Bcast.h"
configuration BcastC {
  provides {
  	interface Bcast;
  }
}
implementation {

	components LedsC;

	//components TimerC;
	//components GenericComm as Comm; // assume it is initialized
#ifdef ENABLE_BCAST
	components BcastP;
        components new TimerMilliC() as TimerC;
	components new TimerMilliC() as Timer2C;
	//components new AMSenderC(AM_BCASTMSG);
	//components new AMReceiverC(AM_BCASTMSG);

	components TimeSyncMessageC;
	//BcastP.RadioControl    ->  ActiveMessageC;
	BcastP.SendBcastMsg    ->  TimeSyncMessageC.TimeSyncAMSendMilli[AM_BCASTMSG];
	BcastP.ReceiveBcastMsg ->  TimeSyncMessageC.Receive[AM_BCASTMSG];
	BcastP.TimeSyncPacket  ->  TimeSyncMessageC;

	
	Bcast = BcastP;
	BcastP.Leds -> LedsC;
	//BcastM.SendBcastMsg -> Comm.SendMsg[AM_BCASTMSG];
	//BcastM.ReceiveBcastMsg -> Comm.ReceiveMsg[AM_BCASTMSG];
	
	//BcastP.SendBcastMsg -> AMSenderC;
	//BcastP.ReceiveBcastMsg -> AMReceiverC;
	
	//BcastM.Timer -> TimerC.Timer[unique("Timer")];
	//BcastM.Timer2 -> TimerC.Timer[unique("Timer")];
	BcastP.Timer -> TimerC;
	BcastP.Timer2 -> Timer2C;
	
	//components LocalTimeMicroC;
	//BcastP.LocalTime -> LocalTimeMicroC;
	
	//components CC2420ControlM;
	//BcastM.RadioControl -> CC2420ControlM;
	components CC2420PacketC;
	BcastP.CC2420Packet -> CC2420PacketC;
	
	//components Main;
	//Main.StdControl -> Comm;
#else
  components BcastNullP;
  components new TimerMilliC() as TimerC;
  components new AMSenderC(AM_BCASTMSG);

  Bcast = BcastNullP;
  BcastNullP.SendBcastMsg -> AMSenderC;
  BcastNullP.Timer -> TimerC;

  components CC2420PacketC;
  BcastNullP.CC2420Packet -> CC2420PacketC;
#endif
}

